A virtual machine is software that is executed on hardware to create a virtualization of a physical computer system. Virtual machines may function as self-contained platforms that run their own operating systems and software applications. A host machine may concurrently run one or more virtual machines using a hypervisor. The hypervisor allocates a certain amount of the host machine's resources, such as the host machine's underlying physical processors and memory devices, to each of the virtual machines. This allocation by the hypervisor allows guests of the virtual machines to transparently access the host machine's resources. Guest applications, including guest operating systems, may be executed on the allocated resources of each virtual machine. Local or remote clients may access these guest applications to perform computing tasks. In some instances, virtual machines and guest applications may be implemented to provide cloud computing environments.
Memory of a host machine and virtual machines running on the host machine is typically divided into memory pages. In some host machines, the hypervisor reduces physical memory consumption by using memory deduplication techniques to reduce the amount of memory pages that store the same data. Memory deduplication improves memory utilization by detecting that two (or more) pages in memory are identical and merging the duplicate pair of pages into a single page. In an example, a first memory page may reside in a first virtual machine's memory space, and a second memory page may reside in a second virtual machine's memory space. If the first and second memory pages have the same content, the first memory page may be considered a duplicate of the second memory page and removed. In such an example, a page table entry of the first virtual machine may be modified to point to the second memory page, and the first virtual machine may use the second memory page rather than the first memory page, thus improving the utilization of memory.
Memory deduplication may be performed by the hypervisor scanning memory pages assigned to virtual machines to identify memory pages that store the same content. The hypervisor consolidates memory pages that store the same content into a single memory page, thereby reducing the amount of memory resources used by the virtual machines.